﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using Enter.DataProxy.DbConnector;
using Enter.DataCommon;

namespace Enter.DataProxy.Mail
{
    public class DemoManager : DataProxyManager
    {
        public DemoManager()
            : base(ProxyProvider.ConfigurationName, ProxyProvider.ConfiruationDbName)
        { 
               
        }


        public int ShowDemo()
        {
            var db = base.CreateDbReader();
        
            string sqltxt = "SELECT TOP 1 [id] FROM [T101_Certified]";
            return db.ExecuteScalar<int>(sqltxt);
        }

        public DataTable ShowTable(int id)
        {
            var db = base.CreateDbReader();


            string sqltxt = "SELECT TOP 10 * FROM [T101_Certified] where id=@id";

            ParameterCollection parameters = CreateParameter(3);

            parameters.Append("id", id);

            return db.ExecuteDataSet(sqltxt, parameters).Tables[0];

        }

        //public IList<Product> ShowEntityList()
        //{
        //    string sqltxt = "SELECT TOP 10 * FROM [T101_Certified] where id=@id";

        //    ParameterCollection parameters = CreateParameter(3);

        //    var db = base.CreateDbReader();
        //    IList<Product> result = null;
        //    result = db.Execute<Product>(sqltxt);

        //    return result;
        //}

        //public Product ShowEntity()
        //{
        //    var db = base.CreateDbReader();
        //    string sqltxt = "SELECT TOP 10 * FROM [T101_Certified]";

        //    ParameterCollection parameters = CreateParameter(3);
        //    parameters.Append("id", 0);

        //    IList<Product> result = null;
        //    result = db.Execute<Product>(sqltxt);

        //    string xx = string.Empty;

        //    Product rr = result[0];

        //    DataTable da = db.ExecuteTable(sqltxt, parameters);
        //    result = null;
        //    result = da.ToList<Product>();
        //    Product rrr = da.First<Product>();
        //    int idss = db.ExecuteScalar<int>(sqltxt);

        //    return rrr;
        //}

    }
}
